package com.springStudy.demo.cycleDepen;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * spring 循环依赖注解
 */
@Configuration
@ComponentScan("com.springStudy.demo.cycleDepen")
public class CycleDependencyInjection {
    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(CycleDependencyInjection.class);
        String[] beanDefinitionNames = context.getBeanDefinitionNames();

        System.out.println("-------------- bean name ---------------");
        for (String beanName : beanDefinitionNames) {
            System.out.println(beanName + " : " + context.getBean(beanName));
        }
    }
}
